Methods and devices for context set selection

ABSTRACT

Methods of encoding and decoding for video data are described for encoding or decoding multi-level significance maps. Distinct context sets may be used for encoding the significant-coefficient flags in different regions of the transform unit. In a fixed case, the regions are defined by coefficient group borders. In one example, the upper-left coefficient group is a first region and the other coefficient groups are a second region. In a dynamic case, the regions are defined by coefficient group borders, but the encoder and decoder dynamically determine in which region each coefficient group belongs. Coefficient groups may be assigned to one region or another based on, for example, whether their respective significant-coefficient-group flags were inferred or not.

COPYRIGHT NOTICE

A portion of the disclosure of this document and accompanying materialscontains material to which a claim for copyright is made. The copyrightowner has no objection to the facsimile reproduction by anyone of thepatent document or the patent disclosure, as it appears in the Patentand Trademark Office files or records, but reserves all other copyrightrights whatsoever.

FIELD

The present application generally relates to data compression and, inparticular, to methods and devices for encoding and decoding video usingsignificance maps.

BACKGROUND

Data compression occurs in a number of contexts. It is very commonlyused in communications and computer networking to store, transmit, andreproduce information efficiently. It finds particular application inthe encoding of images, audio and video. Video presents a significantchallenge to data compression because of the large amount of datarequired for each video frame and the speed with which encoding anddecoding often needs to occur. The current state-of-the-art for videoencoding is the ITU-T H.264/AVC video coding standard. It defines anumber of different profiles for different applications, including theMain profile, Baseline profile and others. A next-generation videoencoding standard is currently under development through a jointinitiative of MPEG-ITU termed High Efficiency Video Coding (HEVC). Theinitiative may eventually result in a video-coding standard commonlyreferred to as MPEG-H.

There are a number of standards for encoding/decoding images and videos,including H.264, that use block-based coding processes. In theseprocesses, the image or frame is divided into blocks, typically 4×4 or8×8, and the blocks are spectrally transformed into coefficients,quantized, and entropy encoded. In many cases, the data beingtransformed is not the actual pixel data, but is residual data followinga prediction operation. Predictions can be intra-frame, i.e.block-to-block within the frame/image, or inter-frame, i.e. betweenframes (also called motion prediction). It is expected that MPEG-H willalso have these features.

When spectrally transforming residual data, many of these standardsprescribe the use of a discrete cosine transform (DCT) or some variantthereon. The resulting DCT coefficients are then quantized using aquantizer to produce quantized transform domain coefficients, orindices.

The block or matrix of quantized transform domain coefficients(sometimes referred to as a “transform unit”) is then entropy encodedusing a particular context model. In H.264/AVC and in the currentdevelopment work for MPEG-H, the quantized transform coefficients areencoded by (a) encoding a last significant coefficient positionindicating the location of the last non-zero coefficient in thetransform unit, (b) encoding a significance map indicating the positionsin the transform unit (other than the last significant coefficientposition) that contain non-zero coefficients, (c) encoding themagnitudes of the non-zero coefficients, and (d) encoding the signs ofthe non-zero coefficients. This encoding of the quantized transformcoefficients often occupies 30-80% of the encoded data in the bitstream.

Transform units are typically N×N. Common sizes include 4×4, 8×8, 16×16,and 32×32, although other sizes are possible, including non-square sizesin some embodiments, such as 16×4, 4×16, 8×32 or 32×8. The entropyencoding of the symbols in the significance map is based upon a contextmodel. In the case of 4×4 or 8×8 luma or chroma blocks or transformunits (TU), a separate context is associated with each coefficientposition in the TU. The encoder and decoder must keep track of and lookup a large number of different contexts during the encoding and decodingof the significance map. In the case of larger TUs, the context forencoding a significant flag may depend on the values of neighboringsignificance flags. For example, the flag may have a context selectedfrom four or five contexts depending on the values of neighboring flags.In some instances, particular flags within a TU or sub-block of a TU mayhave a context based on position, such as the upper-left (DC) position.

BRIEF DESCRIPTION OF THE DRAWINGS

Reference will now be made, by way of example, to the accompanyingdrawings which show example embodiments of the present application, andin which:

FIG. 1 shows, in block diagram form, an encoder for encoding video;

FIG. 2 shows, in block diagram form, a decoder for decoding video;

FIG. 3 shows, an example of a multi-level scan order for a 16×16transform unit;

FIG. 4 illustrates the division of a 16×16 transform unit into two fixedregions using a defined diagonal;

FIG. 5 illustrates the division of a 32×32 transform unit into two fixedregions using a defined diagonal;

FIG. 6 illustrates a coefficient-group based division of a 16×16transform unit into regions for selecting a context set;

FIG. 7 shows an example transform unit divided into contiguouscoefficient groups and example respective significant-coefficient-groupflags for those coefficient groups;

FIG. 8 shows an example of a dynamically determined division of a 16×16transform unit into regions based on the example of FIG. 7;

FIG. 9 shows the example of FIG. 7, with inference correction;

FIG. 10 shows the dynamic division of the transform unit into regionsbased on the example of FIG. 9;

FIG. 11, shows, in flowchart form, an example method of encoding asignificance map;

FIG. 12 shows, in flowchart form, an example method of reconstructing asignificance map from a bitstream of encoded data;

FIG. 13 shows a simplified block diagram of an example embodiment of anencoder; and

FIG. 14 shows a simplified block diagram of an example embodiment of adecoder.

Similar reference numerals may have been used in different figures todenote similar components.

DESCRIPTION OF EXAMPLE EMBODIMENTS

The present application describes methods and encoders/decoders forencoding and decoding significance maps with context-adaptive encodingor decoding. The encoder and decoder use multi-level significance maps.In at least one case, the multi-level maps are used with largertransform units, such as the 16×16 and 32×32 TUs.

In one aspect, the present application describes a method of decoding abitstream of encoded video by reconstructing significant-coefficientflags for a transform unit, the transform unit comprising a sequence ofblocks, the bitstream encoding sets of significant-coefficient flags,each set corresponding to a respective block. The method includes, forone of the sets of significant-coefficient flags, selecting a contextset for use in decoding significant-coefficient flags of that set basedon a position within the transform unit of the block corresponding tothat set of significant-coefficient flags; and decoding thesignificant-coefficient flags of that set using the selected contextset.

In another aspect, the present application describes a method ofdecoding a bitstream of encoded video by reconstructingsignificant-coefficient flags for a transform unit, the transform unitcomprising a sequence of blocks, the bitstream encoding sets ofsignificant-coefficient flags, each set corresponding to a respectiveblock. The method includes, for one of the sets ofsignificant-coefficient flags, determining asignificant-coefficient-group flag for that set; selecting a context setfor use in decoding significant-coefficient flags of that set byselecting a first context set if the significant-coefficient group flagwas decoded from the bitstream, and selecting a different context set ifthe significant-coefficient group flag was determined based on thesignificant-coefficient group flags of at least two neighboring sets ofsignificant-coefficient flags; and decoding the significant-coefficientflags of that set using the selected context set.

In one embodiment, determining includes determining that thesignificant-coefficient-group flag is equal to 1.

In a further embodiment, determining includes inferring that thesignificant-coefficient-group flag is equal to 1 based on aright-neighbor set of significant-coefficient flags having asignificant-coefficient-group flag equal to 1 and a below-neighbor setof significant-coefficient flags equal to 1. In some implementationsthis method further includes, after the decoding, determining whetherthe set contains all zero coefficients and, if so, revising thesignificant-coefficient-group flag for the set to equal 0 for use insubsequently determining whether to infer significant-coefficient-groupflags of adjacent sets of significant-coefficient flags.

In yet another embodiment, determining comprises decoding thesignificant-coefficient-group flag from the bitstream since either aright-neighbor set of significant-coefficient flags has asignificant-coefficient-group flag equal to 0 or a below-neighbor set ofsignificant-coefficient flags equal to 0.

In a further embodiment, the first context set includes a number ofcontexts, wherein selecting the first context set comprises setting acontext index variable to a predetermined value, and wherein selectingthe second context set comprises setting the context index variable tothe predetermined value plus the number of contexts.

In another aspect, the present application describes a method ofencoding a video by encoding significant-coefficient flags for atransform unit to create a bitstream of encoded sets ofsignificant-coefficient flags, the transform unit comprising a sequenceof blocks, each set of significant-coefficient flags corresponding to arespective block. The method includes, for one of the sets ofsignificant-coefficient flags, determining asignificant-coefficient-group flag for that set; selecting a context setfor use in encoding significant-coefficient flags of that set byselecting a first context set if the significant-coefficient group flagwas encoded for insertion into the bitstream, and selecting a differentcontext set if the significant-coefficient group flag was determinedbased on the significant-coefficient group flags of at least twoneighboring sets of significant-coefficient flags; and encoding thesignificant-coefficient flags of that set using the selected contextset.

In a further aspect, the present application describes encoders anddecoders configured to implement such methods of encoding and decoding.

In yet a further aspect, the present application describesnon-transitory computer-readable media storing computer-executableprogram instructions which, when executed, configured a processor toperform the described methods of encoding and/or decoding.

Other aspects and features of the present application will be understoodby those of ordinary skill in the art from a review of the followingdescription of examples in conjunction with the accompanying figures.

In the description that follows, some example embodiments are describedwith reference to the H.264 standard for video coding and/or thedeveloping MPEG-H standard. Those ordinarily skilled in the art willunderstand that the present application is not limited to H.264/AVC orMPEG-H but may be applicable to other video coding/decoding standards,including possible future standards, multi-view coding standards,scalable video coding standards, and reconfigurable video codingstandards.

In the description that follows, when referring to video or images theterms frame, picture, slice, tile and rectangular slice group may beused somewhat interchangeably. Those of skill in the art will appreciatethat, in the case of the H.264 standard, a frame may contain one or moreslices. It will also be appreciated that certain encoding/decodingoperations are performed on a frame-by-frame basis, some are performedon a slice-by-slice basis, some picture-by-picture, some tile-by-tile,and some by rectangular slice group, depending on the particularrequirements or terminology of the applicable image or video codingstandard. In any particular embodiment, the applicable image or videocoding standard may determine whether the operations described below areperformed in connection with frames and/or slices and/or pictures and/ortiles and/or rectangular slice groups, as the case may be. Accordingly,those ordinarily skilled in the art will understand, in light of thepresent disclosure, whether particular operations or processes describedherein and particular references to frames, slices, pictures, tiles,rectangular slice groups are applicable to frames, slices, pictures,tiles, rectangular slice groups, or some or all of those for a givenembodiment. This also applies to transform units, coding units, groupsof coding units, etc., as will become apparent in light of thedescription below.

The present application describes example processes and devices forencoding and decoding significance maps. A significance map is a block,matrix or group of flags that maps to, or corresponds to, a transformunit or a defined unit of coefficients (e.g. several transform units, aportion of a transform unit, or a coding unit). Each flag indicateswhether the corresponding position in the transform unit or thespecified unit contains a non-zero coefficient or not. In existingstandards, these flags may be referred to as significant-coefficientflags. In existing standards, there is one flag per coefficient and theflag is a bit that is zero if the corresponding coefficient is zero andis set to one if the corresponding coefficient is non-zero. The term“significance map” as used herein is intended to refer to a matrix orordered set of significant-coefficient flags for a transform unit, aswill be understood from the description below, or a defined unit ofcoefficients, which will be clear from the context of the applications.

It will be understood, in light of the following description, that themulti-level encoding and decoding structure might be applied in certainsituations, and those situations may be determined from side informationlike video content type (natural video or graphics as identified insequence, picture, or slice headers). For example, two levels may beused for natural video, and three levels may be used for graphics (whichis typically much more sparse). Yet another possibility is to provide aflag in one of the sequence, picture, or slice headers to indicatewhether the structure has one, two, or three levels, thereby allowingthe encoder the flexibility of choosing the most appropriate structurefor the present content. In another embodiment, the flag may represent acontent type, which would be associated with the number of levels. Forexample, a content of type “graphic” may feature three levels.

Note that the present application may use the terms “coefficient group”and “set of significant-coefficient flags” interchangeably. They areintended to have the same meaning.

Reference is now made to FIG. 1, which shows, in block diagram form, anencoder 10 for encoding video. Reference is also made to FIG. 2, whichshows a block diagram of a decoder 50 for decoding video. It will beappreciated that the encoder 10 and decoder 50 described herein may eachbe implemented on an application-specific or general purpose computingdevice, containing one or more processing elements and memory. Theoperations performed by the encoder 10 or decoder 50, as the case maybe, may be implemented by way of application-specific integratedcircuit, for example, or by way of stored program instructionsexecutable by a general purpose processor. The device may includeadditional software, including, for example, an operating system forcontrolling basic device functions. The range of devices and platformswithin which the encoder 10 or decoder 50 may be implemented will beappreciated by those ordinarily skilled in the art having regard to thefollowing description.

The encoder 10 receives a video source 12 and produces an encodedbitstream 14. The decoder 50 receives the encoded bitstream 14 andoutputs a decoded video frame 16. The encoder 10 and decoder 50 may beconfigured to operate in conformance with a number of video compressionstandards. For example, the encoder 10 and decoder 50 may be H.264/AVCcompliant. In other embodiments, the encoder 10 and decoder 50 mayconform to other video compression standards, including evolutions ofthe H.264/AVC standard, like MPEG-H.

The encoder 10 includes a spatial predictor 21, a coding mode selector20, transform processor 22, quantizer 24, and entropy encoder 26. Aswill be appreciated by those ordinarily skilled in the art, the codingmode selector 20 determines the appropriate coding mode for the videosource, for example whether the subject frame/slice is of I, P, or Btype, and whether particular coding units (e.g. macroblocks, codingunits, etc.) within the frame/slice are inter or intra coded. Thetransform processor 22 performs a transform upon the spatial domaindata. In particular, the transform processor 22 applies a block-basedtransform to convert spatial domain data to spectral components. Forexample, in many embodiments a discrete cosine transform (DCT) is used.Other transforms, such as a discrete sine transform or others may beused in some instances. The block-based transform is performed on acoding unit, macroblock or sub-block basis, depending on the size of themacroblocks or coding units. In the H.264 standard, for example, atypical 16×16 macroblock contains sixteen 4×4 transform blocks and theDCT process is performed on the 4×4 blocks. In some cases, the transformblocks may be 8×8, meaning there are four transform blocks permacroblock. In yet other cases, the transform blocks may be other sizes.In some cases, a 16×16 macroblock may include a non-overlappingcombination of 4×4 and 8×8 transform blocks.

Applying the block-based transform to a block of pixel data results in aset of transform domain coefficients. A “set” in this context is anordered set in which the coefficients have coefficient positions. Insome instances the set of transform domain coefficients may beconsidered as a “block” or matrix of coefficients. In the descriptionherein the phrases a “set of transform domain coefficients” or a “blockof transform domain coefficients” are used interchangeably and are meantto indicate an ordered set of transform domain coefficients.

The set of transform domain coefficients is quantized by the quantizer24. The quantized coefficients and associated information are thenencoded by the entropy encoder 26.

The block or matrix of quantized transform domain coefficients may bereferred to herein as a “transform unit” (TU). In some cases, the TU maybe non-square, e.g. a non-square quadrature transform (NSQT).

Intra-coded frames/slices (i.e. type I) are encoded without reference toother frames/slices. In other words, they do not employ temporalprediction. However intra-coded frames do rely upon spatial predictionwithin the frame/slice, as illustrated in FIG. 1 by the spatialpredictor 21. That is, when encoding a particular block the data in theblock may be compared to the data of nearby pixels within blocks alreadyencoded for that frame/slice. Using a prediction algorithm, the sourcedata of the block may be converted to residual data. The transformprocessor 22 then encodes the residual data. H.264, for example,prescribes nine spatial prediction modes for 4×4 transform blocks. Insome embodiments, each of the nine modes may be used to independentlyprocess a block, and then rate-distortion optimization is used to selectthe best mode.

The H.264 standard also prescribes the use of motionprediction/compensation to take advantage of temporal prediction.Accordingly, the encoder 10 has a feedback loop that includes ade-quantizer 28, inverse transform processor 30, and deblockingprocessor 32. The deblocking processor 32 may include a deblockingprocessor and a filtering processor. These elements mirror the decodingprocess implemented by the decoder 50 to reproduce the frame/slice. Aframe store 34 is used to store the reproduced frames. In this manner,the motion prediction is based on what will be the reconstructed framesat the decoder 50 and not on the original frames, which may differ fromthe reconstructed frames due to the lossy compression involved inencoding/decoding. A motion predictor 36 uses the frames/slices storedin the frame store 34 as source frames/slices for comparison to acurrent frame for the purpose of identifying similar blocks.Accordingly, for macroblocks or coding units to which motion predictionis applied, the “source data” which the transform processor 22 encodesis the residual data that comes out of the motion prediction process.For example, it may include information regarding the reference frame, aspatial displacement or “motion vector”, and residual pixel data thatrepresents the differences (if any) between the reference block and thecurrent block. Information regarding the reference frame and/or motionvector may not be processed by the transform processor 22 and/orquantizer 24, but instead may be supplied to the entropy encoder 26 forencoding as part of the bitstream along with the quantized coefficients.

Those ordinarily skilled in the art will appreciate the details andpossible variations for implementing video encoders.

The decoder 50 includes an entropy decoder 52, dequantizer 54, inversetransform processor 56, spatial compensator 57, and deblocking processor60. The deblocking processor 60 may include deblocking and filteringprocessors. A frame buffer 58 supplies reconstructed frames for use by amotion compensator 62 in applying motion compensation. The spatialcompensator 57 represents the operation of recovering the video data fora particular intra-coded block from a previously decoded block.

The bitstream 14 is received and decoded by the entropy decoder 52 torecover the quantized coefficients. Side information may also berecovered during the entropy decoding process, some of which may besupplied to the motion compensation loop for use in motion compensation,if applicable. For example, the entropy decoder 52 may recover motionvectors and/or reference frame information for inter-coded macroblocks.

The quantized coefficients are then dequantized by the dequantizer 54 toproduce the transform domain coefficients, which are then subjected toan inverse transform by the inverse transform processor 56 to recreatethe “video data”. It will be appreciated that, in some cases, such aswith an intra-coded macroblock or coding unit, the recreated “videodata” is the residual data for use in spatial compensation relative to apreviously decoded block within the frame. The spatial compensator 57generates the video data from the residual data and pixel data from apreviously decoded block. In other cases, such as inter-codedmacroblocks or coding units, the recreated “video data” from the inversetransform processor 56 is the residual data for use in motioncompensation relative to a reference block from a different frame. Bothspatial and motion compensation may be referred to herein as “predictionoperations”.

The motion compensator 62 locates a reference block within the framebuffer 58 specified for a particular inter-coded macroblock or codingunit. It does so based on the reference frame information and motionvector specified for the inter-coded macroblock or coding unit. It thensupplies the reference block pixel data for combination with theresidual data to arrive at the reconstructed video data for that codingunit/macroblock.

A deblocking/filtering process may then be applied to a reconstructedframe/slice, as indicated by the deblocking processor 60. Afterdeblocking/filtering, the frame/slice is output as the decoded videoframe 16, for example for display on a display device. It will beunderstood that the video playback machine, such as a computer, set-topbox, DVD or Blu-Ray player, and/or mobile handheld device, may bufferdecoded frames in a memory prior to display on an output device.

It is expected that MPEG-H-compliant encoders and decoders will havemany of these same or similar features.

Significance Map Encoding

As noted above, the entropy coding of a block or set of quantizedtransform domain coefficients includes encoding the significance map(e.g. a set of significant-coefficient flags) for that block or set ofquantized transform domain coefficients. The significance map is abinary mapping of the block indicating in which positions (other thanthe last position) non-zero coefficients appear. The significance mapmay be converted to a vector in accordance with the scan order (whichmay be vertical, horizontal, diagonal, zig zag, or any other scanorder). The scan is typically done in “reverse” order, i.e. startingwith the last significant coefficient and working back through thesignificant map in reverse direction until the flag in the upper-leftcorner at [0,0] is reached. In the present description, the term “scanorder” is intended to mean the order in which flags, coefficients, orgroups, as the case may be, are processed and may include orders thatare referred to colloquially as “reverse scan order”.

Each significant-coefficient flag is then entropy encoded using theapplicable context-adaptive coding scheme. For example, in manyapplications a context-adaptive binary arithmetic coding (CABAC) schememay be used.

With 16×16 and 32×32 significance maps, the context for a significant is(mostly) based upon neighboring significant-coefficient flag values.Among the contexts used for 16×16 and 32×32 significance maps, there arecertain contexts dedicated to the bit position at [0,0] and (in someexample implementations) to neighboring bit positions, but most of thesignificant-coefficient flags take one of four or five contexts thatdepend on the cumulative values of neighboring significant-coefficientflags. In these instances, the determination of the correct context fora significant-coefficient flag depends on determining and summing thevalues of the significant-coefficient flags at neighboring locations(typically five locations, but it could be more or fewer in someinstances).

In previous work, the present applicants described the use ofmulti-level significance maps, in which the significance map of atransform unit is partitioned into coefficient groups and eachcoefficient group is encoded in a predefined order or sequence. Withineach coefficient group (which may be a block/sub-block) thesignificant-coefficient flags are processed in a scan order. Eachcoefficient group is associated with a significant-coefficient-groupflag, which indicates whether that coefficient group may be consideredto contain non-zero significant-coefficient flags. Reference may be madeto U.S. patent application Ser. No. 13/286,336, filed Nov. 1, 2011,entitled “Multi-level Significance Maps for Encoding and Decoding”; andU.S. patent application Ser. No. 61/561,872, filed Nov. 19, 2011,entitled “Multi-level Significance Map Scanning”. The contents of bothapplications are hereby incorporated by reference.

One of the techniques described in the foregoing applications isimplementation of a one-pass scanning process; i.e. a group-based ormulti-level scanning order. Reference is now made to FIG. 3, which showsa 16×16 transform unit 100 with a multi-level diagonal scan orderillustrated. The transform unit 100 is partitioned into sixteencontiguous 4×4 coefficient groups or “sets of significant-coefficientflags”. Within each coefficient group, a diagonal scan order is appliedwithin the group, rather than across the whole transform unit 100. Thesets or coefficient groups themselves are processed in a scan order,which in this example implementation is also a diagonal scan order. Itwill be noted that the scan order in this example is illustrated in“reverse” scan order; that is, the scan order is shown progressing fromthe bottom-right coefficient group in a downward-left diagonal directiontowards the upper-left coefficient group. In some implementations thesame scan order may be defined in the other direction; that is,progressing in am upwards-right diagonal direction and when appliedduring encoding or decoding may be applied in a “reverse” scan order.

The use of multi-level significance maps involves the encoding of an L1or higher level significance map that indicates which coefficient groupsmay be expected to contain non-zero significant-coefficient flags, andwhich coefficient groups contain all zero significant-coefficient flags.The coefficient groups that may be expected to contain non-zerosignificant-coefficient flags have their significant-coefficient flagsencoded, whereas the coefficient groups that contain all zerosignificant-coefficient flags are not encoded (unless they are groupsthat are encoded because of a special case exception because they arepresumed to contain at least one non-zero significant-coefficient flag).Each coefficient group has a significant-coefficient-group flag (unlessa special case applies in which that coefficient group has a flag of apresumed value, such as the group containing the last significantcoefficient, the upper left group, etc.).

The coefficient-group flags are either determined based on the contentof the coefficient group, i.e. based on whether there are, in fact, anynon-zero coefficients within the coefficient group; or, thecoefficient-group-flag is inferred. For example, in at least oneembodiment, the coefficient-group flag is set to zero if there are nonon-zero coefficients in the coefficient group and is set to one ifthere is at least one non-zero coefficient in the coefficient group;however, to save bits in some cases a coefficient-group flag is notencoded and decoded but rather is inferred based on the value ofneighboring coefficient-group flags. For instance, in one embodiment acoefficient-group flag is inferred to be 1 if the lower neighboringcoefficient-group flag and the right neighboring coefficient-group flagare both equal to 1.

Context-Based Processing of Significant-Coefficient Flags

The encoding and decoding of the significant-coefficient flags is basedon is context-based. In other words, the encoding and decoding dependson determining an estimated probability that the bin being encoded is amost-probable symbol (MPS). That determination of estimated probabilitydepends, in turn, upon determining a context for the current symbol.Typically, the context-based encoder and decoder work in accordance witha context model that specifies how context it to be determined forparticular types of data, and that defines a set of contexts.

In the case of significant-coefficient flags, the context model basesthe context determination on the values of neighboringsignificant-coefficient flags (except for particular exceptions, likethe DC value at [0,0]). For example with size 16×16 or 32×32 transformunits, the context of significant-coefficient flag “x” is dependent uponfive neighboring flags as follows:

$\begin{matrix}x & o & o \\o & o & \; \\o & \; & \;\end{matrix}$

The cumulative sum of the values of the five neighboring flags may beused to indicate the context for the significant-coefficient flag atposition x. Accordingly, there may be up to six contexts. In someinstances, the number of contexts may be capped, for example at 4. Anexample context determination model is as follows:context_x=(sum_neighbor_flags+1)/2

The above context_x is a context index to a “context set” for encodingsignificant-coefficient flags. That is, when determining the context forencoding a particular significant-coefficient flag, the context isselected from one of the contexts defined in the context set.

In some example implementations, more than one context set may bedefined by the model for encoding significant-coefficient flags. Forexample, the encoder and decoder may use one context set for encodingsignificant-coefficient flags falling into a first region of thetransform unit and a second separate context set for encodingsignificant-coefficient flags falling into a second region (or a thirdregion, etc.) of the transform unit.

Working with the example above, the contexts from the second set mayinclude contexts 4, 5, 6, and 7, and selection of the appropriatecontext for a particular significant-coefficient flag in the secondregion may be based on a context determination model of:offset=0If region=region 2, set offset=4sum_neighbor_flags=0 context_x=0+offsetsum_neighbor_flags=1 context_x=1+offsetsum_neighbor_flags=2 context_x=2+offsetsum_neighbor_flags≧3 context_x=3+offset

In some current implementations, a transform unit is divided into afirst region and a second region for the purpose of contextdetermination using a fixed diagonal definition. For example, with a16×16 transform unit, the diagonal is defined by x+y=4. This results ina region such as that shown in FIG. 4, which illustrates an example16×16 transform unit 110. The example transform unit 110 includes afirst region 112 and a second region 114, divided in accordance with thex+y<4 diagonal definition. That is, all significant-coefficient flagsfor which x+y<4 are in the first region 112. In this case, the DC valueat [0,0] has its own context. In some sense, the DC location may beconsidered a “third region” in which there is a single context in thecontext set.

Reference is now made to FIG. 5, which shows an example of a 32×32transform unit 120. The transform unit 120 is divided or partitionedinto a first region 122 and a second region 124 in accordance with adiagonal definition of x+y<8. That is, all significant-coefficient flagsfor which x+y<8 are in the first region 122, except the DCsignificant-coefficient flag 126, and are those significant-coefficientflags are encoded using a first context set. All othersignificant-coefficient flags for which x+y≧8 are in the second set andare encoded using a second context set. The DC significant-coefficientflag 126 is encoded using its own context. In this sense the DC positionmay be considered a third region by itself.

The present application provides other approaches to selecting a contextset for encoding the significant-coefficient flags of a transform unit.

In a first embodiment, the context set selection is fixed, like with thediagonal definition examples given above; however, in this firstembodiment, the first region is not defined by a diagonal. Instead thefirst region is defined to correspond to a coefficient group definition.In this manner, the context set selection is coefficient-group based,which improves the modularity of significant-coefficient encoding in amulti-level significance map embodiment. Multiple regions could bedefined, each of them being delimited by coefficient group boundaries.The DC position can be considered as a region.

FIG. 6 shows an example of a 16×16 transform unit 200 divided orpartitioned into context regions based on coefficient-group definitions.In this example, a first region 202 includes all significant-coefficientflags within the first coefficient group (may also be considered thelast coefficient group in reverse scan order), excluding the DCsignificant-coefficient flag 206. That is the first region 202 includesall significant-coefficient flags for which x<4 and y<4, excluding[0,0]. All significant-coefficient flags within the other coefficientgroups of the transform unit 200 are in a second region 204. Thesignificant-coefficient flags within the first region 202 are encodedusing a first context set while the significant-coefficient flags withinthe second region 204 are encoded using a second context set. In oneexample implementation, the encoder and/or decoder determines whether asignificant-coefficient flags is within the first region, i.e. in theupper-left coefficient group, by determining whether an x-coordinate anda y-coordinate of the flag are each within 4 positions of the upper-leftcorner of the transform unit.

In other variations, the first region may include more than onecoefficient group. For example, in a 32×32 transform unit, if thecoefficient groups are 4×4, then the first region may include the threeor four coefficient groups in the upper left corner of the transformunit. Or, in another example, the 16×16 transform unit 200 may includethree or more coefficient groups in the first region 202. Othervariations will be appreciated in light of the present description.

In this first embodiment, the encoder and decoder processsignificant-coefficient flags by determining their context using acontext set selected based on the coefficient group in which thesignificant-coefficient flags belong. The position of the coefficientgroup within the transform unit determines the context set selected.That is, each coefficient group within the transform unit is associatedwith a certain context set, i.e. each coefficient group is a member ofone of the defined regions, and each region has an associated contextset.

In a second embodiment, the regions are still coefficient-group based,but the boundary between the first and second regions is determineddynamically. In one example of this second embodiment, the division isbased upon whether the coefficient-group flag of a particularcoefficient group was inferred to 1 or not. That is, thecoefficient-group is assigned to a region based upon thecoefficient-group flags of its right and bottom neighboring coefficientgroups.

Reference is made to FIG. 7, which diagrammatically shows a 16×16transform unit 220 divided into 4×4 contiguous sets ofsignificant-coefficient flags, i.e. coefficient groups. The coefficientgroups may be indexed using the x-y coordinates shown (x=0, . . . , 3;y=0, . . . , 3). The significant-coefficient-group flag (SCGflag)determined for each of the coefficient groups is shown in the diagraminside the respective coefficient group.

As will be appreciated from the foregoing discussion, the transform unit220 contains a last-significant-coefficient (LSC) in one of thecoefficient groups. For the purposes of this example, the LSC ispresumed to be in coefficient group [2, 2]. All groups prior to thecoefficient group [2, 2] in scan order necessarily contain all zeros.

The significant-coefficient group flag for coefficient group [2, 2] isnecessarily 1, since it contains the LSC, which means it contains atleast one non-zero coefficient.

In the example shown, the next coefficient group in reverse scan orderis coefficient group [1, 3], which contains all zero coefficients.Accordingly, its significant-coefficient-group flag is a 0.

The next coefficient groups in reverse scan order, groups [3, 0], [2,1], and [1, 2] are all found to contain at least one non-zerocoefficient. Accordingly, each of them has asignificant-coefficient-group flag of 1. Coefficient group [0, 3] isfound to contain all zero coefficients, so itssignificant-coefficient-group flag is determined to be 0.

The next group in reverse scan order is coefficient group [2, 0].Because its right-neighbor coefficient group and its lower-neighborcoefficient group both have SCGflag=1, the significant-coefficient-groupflag for coefficient group [2, 0] is inferred or assumed to be 1,irrespective of whether there are any non-zero coefficients incoefficient group [2, 0] or not. The same inference is made withcoefficient group [1, 1]. Coefficient group [0, 2] has a lower-neighborwith a significant-coefficient-group flag of zero, so no inference ismade. In the case of coefficient group [0, 2], it is found to contain anon-zero coefficient so its significant-coefficient-group flag is setto 1. All remaining coefficient groups in reverse scan order havesignificant-coefficient group flags that are inferred to be 1.

Any of the inferred significant-coefficient-groups flags need not beencoded in the bitstream or decoded at the decoder. They are assumed tobe equal to 1, and the encoder and decoder automatically encode thesignificant-coefficient flags of those coefficient groups, even if oneof them contains all zero coefficients.

Reference is now also made to FIG. 8, which shows the dynamic regiondivision for an example illustration of the second embodiment based onthe transform unit 220 shown in FIG. 7. In this second embodiment, afirst region (indicated by the symbol ‘1’ in the coefficient groupsbelonging to the first region) for encoding the significant-coefficientflags is defined as including those coefficient groups for which thesignificant-coefficient-group flag is inferred to be 1. A second region(indicated by the symbol ‘2’ in the coefficient groups belonging to thesecond region) contains those coefficient groups that have asignificant-coefficient-group that was not inferred. It will beunderstood that those coefficient groups for which thesignificant-coefficient-group flag is zero need not be included in aregion since the significant-coefficient flags of those groups are notencoded. The DC position 226 may still have its own context and, thus,is not necessarily considered part of the first region.

From the foregoing description it will be appreciated that the first andsecond regions have a boundary along coefficient group borders, but thelocation of which dynamically changes from transform unit to transformunit, dependent upon the content of the transform unit in question. Bymaintaining the separation of the regions along coefficient groupboundaries some efficiency in modular processing and code simplificationmay be achievable. The dynamic movement of the boundary may improve thespeed with which the respective context sets associated with the tworegions converge towards a probability distribution reflective of actualstatistical data, thereby improving the rate at which coding efficiencyis improved.

It will be appreciated that one mechanism for implementing the foregoingregion determination process would be to assign each coefficient groupto a region based upon the significant-coefficient group flags of itsright and lower neighbor coefficient groups. That is, if either of thesignificant-coefficient group flags of the right and lower neighborcoefficient groups equal 0, then the coefficient group belongs in regiontwo; otherwise, it belongs in region one. The upper-left cornercoefficient group may always be classified in region one in someembodiments.

A third embodiment is now described, which may be considered a variationor refinement of the second embodiment. In the third embodiment, theboundary between the regions is still dynamically determined based uponwhether significant-coefficient-groups were inferred to be 1 or not, andthe boundary continues to lie along coefficient group boundaries;however, the third embodiment includes assessing whether the inferencewas accurate or not and making adjustments to the categorization oflater coefficient groups based upon a reclassification of the incorrectinference.

Reference is now made to FIG. 9, which shows an example transform unit250. In this case, the determination of significant-coefficient-groupflags for the various coefficient groups occurs as described above inconnection with FIG. 7. However, in this case, the encoder and decoderevaluate whether the inferences were accurate or not. For example, thecoefficient group [1, 1] may, in fact, contain all zero coefficients.These coefficients are actually encoded in the bitstream and are decodedby the decoder because the significant-coefficient-group flag is set to1, although by incorrect inference or assumption.

In FIG. 9, this is indicated as ‘inferred incorrect’.

At the time of decoding the significant-coefficient flags forcoefficient group [1, 1], the decoder would not be aware that theinference is incorrect and, accordingly, would understand thiscoefficient group to be part of the first region since it has aninferred significant-coefficient-group flag. Accordingly, the encoderand decoder both use the context set associated with the first regionwhen encoding and decoding the significant-coefficient flags ofcoefficient group [1, 1]. However, when it comes to processingsubsequent coefficient groups the encoder and decoder may take thisknowledge of the incorrect inference into account. For example, whendetermining the significant-coefficient group flags for coefficientgroups [1, 0] and [0, 1], they can consider their neighbor coefficientgroup at [1, 1] as having a significant-coefficient group flag equal to0, even though it actually used an inferred flag equal to 1 and had itssignificant-coefficient flags encoded. As shown in FIG. 9, thecoefficient groups [1, 0] and [0, 1] have theirsignificant-coefficient-group flags set to 1 based on the fact that theyactually contain at least one non-zero coefficient.

It will be appreciated that this ‘correction’ of the incorrect inferencefor processing later coefficient groups may be limited to correcting theinference for the purpose of assigning coefficient groups to regionsonly, or it may also be corrected for the purpose of actuallydetermining the significant-coefficient flag for those later coefficientgroups that may have relied upon the incorrect inference in makinganother inference.

As a result, the number of coefficient groups for which an inference wasused to determine the significant-coefficient-group flag changes to justthree. This has an impact upon the shape of the regions used forselecting context sets for encoding the significant-coefficient flags.FIG. 10 shows the transform unit 250 with the first and second regionsindicated thereon. It will be noted that the coefficient groups thatmake up a region need not be continuous or contiguous in this case.

Reference is now made to FIG. 11, which shows an example method 300 ofencoding video employing the second embodiment of a process forselecting context sets for encoding significant-coefficient flags.

The method 300 includes, for a coefficient group, i.e. set ofsignificant-coefficient flags, determining whether thesignificant-coefficient-group flag should be inferred in operation 302.As described above, the context model in this example provides that thesignificant-coefficient-group flag is inferred to be 1 if thesignificant-coefficient-group flags of the right-neighbor coefficientgroup and the lower-neighbor coefficient group are both equal to 1. Ifthat is the case, then in operation 304 thesignificant-coefficient-group flag of the current coefficient group isset to 1. If that is not the case, then the encoder actually looks atthe data in the coefficient group to determine whether there are anynon-zero coefficients, as indicated by operation 306. If all thesignificant-coefficient flags of the current coefficient group are zero,then the significant-coefficient-group flag is set to zero in operation308. Operation 308 may include encoding the significant-coefficientgroup flag. Then in operation 310, the encoder moves to the nextcoefficient group in scan order and returns to operation 302 to startthe process over.

If the coefficient group is found to contain at least one non-zerosignificant-coefficient flag, then in operation 307 thesignificant-coefficient-group flag is set to 1. Operation 307 may alsoinclude encoding the significant-coefficient-group flag.

If the significant-coefficient-group flag was inferred in operation 304,then in operation 314 the first context set is selected. In anembodiment in which there are a large number of defined contexts, and inwhich the first context set include a predetermined number of thosedefined contexts, then the selecting of the first context set may beimplemented by setting a context index to point to a predetermined oneof those defined contexts within the first context set.

If the significant-coefficient-group flag was determined based onwhether there were non-zero coefficients in the coefficient group inoperation 307, then in operation 316 the second context set is selected.In some implementations, the selection of the second context setincludes setting a context index variable to point to one of the definedcontexts within the second context set.

Whether using the first context set or the second context set, inoperation 318 the selected context set is used for encoding thesignificant-coefficient flags of the current coefficient group. For thelast coefficient group, this may include encoding the DCsignificant-coefficient flag using its own assigned context, and anyother such flags as may have their own context based upon their locationin the transform unit. Operation 320 determines whether it is the lastcoefficient group in the transform unit. If so, then the encoder may goon to the next encoding step with regard to the transform unit (whichmay include encoding the coefficient levels and/or signs). Otherwise,the encoder moves to the next coefficient group in reverse scan orderand repeats the process.

Reference will now be made to FIG. 12, which shows an example method 400for decoding a bitstream of encoded video data to reconstruct asignificance map for a transform unit. The significance map ispartitioned into contiguous sets of significant-coefficient flags, i.e.coefficient groups.

In operation 402 the decoder determines whether thesignificant-coefficient-group flag for the current coefficient groupshould be inferred. If so, then in operation 412 it is set to 1. If not,then in operation 404 the significant-coefficient-group flag is decodedfrom the bitstream. As discussed above, in this example thesignificant-coefficient-group flag is inferred if thesignificant-coefficient-group flags for the right-neighbor coefficientgroup and the lower-neighbor coefficient group are both equal to 1.

In operation 408, if the decoded significant-coefficient-group flag isequal to 0, then in operation 408 all the significant-coefficient flagsof that coefficient group are set to 0. The decoder then moves to thenext coefficient group in reverse scan order, as indicated by operation410, and then repeats the process from operation 402.

If the decoded significant-coefficient-group flag is not zero, then inoperation 414 the second context set is selected. If thesignificant-coefficient-group flag was inferred to be 1, then inoperation 416 the first context set is selected. In either case, inoperation 418 the selected context set is used to decode thesignificant-coefficient flags of that coefficient group. Operation 420involves determining whether it is the last coefficient group and, ifso, moving on to the next phase of decoding. Otherwise, the decodermoves to the next coefficient group in reverse scan order and returns tooperation 402 to continue the decoding process forsignificant-coefficient flags.

Below is illustrated one example of the first embodiment of the decodingprocess using pseudo-code. The first embodiment of the decoding processis one in which the regions are fixed along coefficient groupboundaries. This example pseudo-code is but one possible implementationof one possible division of the transform unit into regions.

In the syntax exemplified by the pseudo-code below, if the transformunit size is 16×16 or 32×32 (e.g. log 2TrafoSize>3), then the exampleprocess is performed. Note that the specific integer values used belowfor the index variable sigCtx are examples only of a predetermined indexto a large number of defined contexts.

Inputs to this process are the color component index cIdx, the currentcoefficient scan position (xC, yC), the transform block width log2TrafoWidth and the transform block height log 2TrafoHeight. The outputof this process is ctxIdxInc.

The variable sigCtx depends on the current position (xC, yC), thetransform block size and previously decoded bins of the syntax elementsignificant_coeff_flag and significant_coeffgroup_flag. For thederivation of sigCtx, the following applies.

If log 2TrafoWidth is equal to log 2TrafoHeight and log 2TrafoWidth isequal to 2, sigCtx is derived using ctxIdxMap4×4[ ] as follows.sigCtx=ctxIdxMap4×4[((cIdx>0)?15:0)+(yC<<2)+xC]

Otherwise if log 2TrafoWidth is equal to log 2TrafoHeight and log2TrafoWidth is equal to 3, sigCtx is derived using ctxIdxMap8×8[ ] asfollows.sigCtx=((xC+yC)==0)?10:ctxIdxMap8×8[((yC>>1)<<2)+(xC>>1)]sigCtx+=(cIdx>0)?6:9

Otherwise if xC+yC is equal to 0, sigCtx is derived as follows.sigCtx=(cIdx>0)?17:20

Otherwise (xC+yC is greater than 0), sigCtx is derived using previouslydecoded bins of the syntax element significant_coeff_flag as follows.

The variable sigCtx is initialized to 0.

When xC is less than (1<<log 2TrafoWidth)−1, the following applies.sigCtx=sigCtx+significant_coeff_flag[xC+1][yC]

When xC is less than (1<<log 2TrafoWidth)−1 and yC is less than (1<<log2TrafoHeight)−1, the following applies.sigCtx=sigCtx+significant_coeff_flag[xC+1][yC+1]

When xC is less than (1<<log 2Width)−2, the following applies.sigCtx=sigCtx+significant_coeff_flag[xC+2][yC]

When all of the following conditions are true,

-   -   yC is less than (1<<log 2TrafoHeight)−1,    -   xC % 4 is not equal to 0 or yC % 4 is not equal to 0,    -   xC % 4 is not equal to 3 or yC % 4 is not equal to 2, the        following applies.        sigCtx=sigCtx+significant_coeff_flag[xC][yC+1]

When yC is less than (1<<log 2TrafoHeight)−2 and sigCtx is less than 4,the following applies.sigCtx=sigCtx+significant_coeff_flag[xC][yC+2]

The variable sigCtx is modified as follows.

If cIdx is equal to 0 and both xC and yC are greater than or equal to1<<(max(log 2TrafoWidth, log 2TrafoHeight)−2), the following applies.sigCtx=((sigCtx+1)>>1)+24

Otherwise, the following applies.sigCtx=((sigCtx+1)>>1)+((cIdx>0)?18:21)

The context index increment ctxIdxInc is derived using the colorcomponent index cIdx and sigCtx as follows.

If cIdx is equal to 0, ctxIdxInc is derived as follows.ctxIdxInc=sigCtx

Otherwise (cIdx is greater than 0), ctxIdxInc is derived as follows.ctxIdxInc=27+sigCtx

An example syntax for implementing the second embodiment of the decodingprocess may also be illustrated. The second embodiment is one in whichthe regions are dynamically determined based on the manner in which thecoefficient-group-flag was obtained, i.e. whether through decoding or byway of inference.

The example syntax for the second embodiment may be substantiallyidentical to the syntax shown above for the first embodiment except thatthe modification to sigCtx, shown just before the derivation ofctxIdxInc, is replaced with:

If cIdx is equal to 0 and at least one of the following conditions istrue,

-   -   (xC>>2)+(yC>>2) is equal to 0,    -   (xC<<2) is less than (1<<log 2TrafoWidth−2)−1, (yC>>2) is less        than (1<<log 2TrafoHeight−2)−1, and        -   significant_coeffgroup_flag[(xC>>2)+1][yC>>2]+significant_coeffgroup_flag[xC>>2][(yC>>2)+1]            is equal to 2,

the following applies.

sigCtx=((sigCtx+1)−1)+24 Otherwise, the following applies.sigCtx=((sigCtx+1)>>1)+((cIdx>0)?18:21)

Reference is now made to FIG. 13, which shows a simplified block diagramof an example embodiment of an encoder 900. The encoder 900 includes aprocessor 902, memory 904, and an encoding application 906. The encodingapplication 906 may include a computer program or application stored inmemory 904 and containing instructions for configuring the processor 902to perform operations such as those described herein. For example, theencoding application 906 may encode and output bitstreams encoded inaccordance with the processes described herein. It will be understoodthat the encoding application 906 may be stored in on a computerreadable medium, such as a compact disc, flash memory device, randomaccess memory, hard drive, etc.

Reference is now also made to FIG. 14, which shows a simplified blockdiagram of an example embodiment of a decoder 1000. The decoder 1000includes a processor 1002, a memory 1004, and a decoding application1006. The decoding application 1006 may include a computer program orapplication stored in memory 1004 and containing instructions forconfiguring the processor 1002 to perform operations such as thosedescribed herein. The decoding application 1006 may include an entropydecoder configured to reconstruct residuals based, at least in part, onreconstructing significant-coefficient flags, as described herein. Itwill be understood that the decoding application 1006 may be stored inon a computer readable medium, such as a compact disc, flash memorydevice, random access memory, hard drive, etc.

It will be appreciated that the decoder and/or encoder according to thepresent application may be implemented in a number of computing devices,including, without limitation, servers, suitably programmed generalpurpose computers, audio/video encoding and playback devices, set-toptelevision boxes, television broadcast equipment, and mobile devices.The decoder or encoder may be implemented by way of software containinginstructions for configuring a processor to carry out the functionsdescribed herein. The software instructions may be stored on anysuitable non-transitory computer-readable memory, including CDs, RAM,ROM, Flash memory, etc.

It will be understood that the encoder described herein and the module,routine, process, thread, or other software component implementing thedescribed method/process for configuring the encoder may be realizedusing standard computer programming techniques and languages. Thepresent application is not limited to particular processors, computerlanguages, computer programming conventions, data structures, other suchimplementation details. Those skilled in the art will recognize that thedescribed processes may be implemented as a part of computer-executablecode stored in volatile or non-volatile memory, as part of anapplication-specific integrated chip (ASIC), etc.

Certain adaptations and modifications of the described embodiments canbe made. Therefore, the above discussed embodiments are considered to beillustrative and not restrictive.

What is claimed is:
 1. A method of decoding a bitstream of encoded videoby reconstructing significant-coefficient flags for a transform unit,the transform unit comprising a sequence of blocks in a scan order, thebitstream encoding sets of significant-coefficient flags, each setcorresponding to a respective block, each block having an associatedsignificant-coefficient-group flag that indicates whether thesignificant-coefficient flags corresponding to that block are to bedecoded from the bitstream or may be inferred to be zero, the methodcomprising: (i) for a set of significant-coefficient flags correspondingto a first block with an associated non-zerosignificant-coefficient-group flag, selecting a context set from aplurality of context sets for use in decoding significant-coefficientflags of that set based on a significant-coefficient-group flagassociated with a block to the right of the first block and asignificant-coefficient-group flag associated with a block below thefirst block, wherein the context sets identify the contexts to be usedin context-adaptively decoding the significant-coefficient flags of thatset of significant-coefficient flags, and wherein selecting includesselecting a first context set if both of thesignificant-coefficient-group flags are non-zero, and, otherwise,selecting a different, mutually exclusive context set; (ii) entropydecoding the significant-coefficient flags of that set using theselected context set by, for each significant-coefficient flag,selecting a context from within the selected context set forcontext-adaptively decoding that significant-coefficient flag; and (iii)moving to the next block in the scan order and returning to operation(i), wherein each significant-coefficient-group flag indicates whetherits associated block is presumed to contain at least one non-zerosignificant-coefficient flag, wherein for each block in the sequence ofblocks that has an associated significant coefficient-group flag that isdecoded to be zero, there are no non-zero significant-coefficient flagsin that block, and for each block in the sequence of blocks that has anassociated significant-coefficient-group flag that is decoded to benon-zero, there is at least one non-zero significant-coefficient flag inthat block, and wherein for each block in the sequence of blocks thathas an associated significant-coefficient-group flag that is zero, allof the significant-coefficient flags in that block are set to zeroinstead of performing the selecting operation and the entropy decodingoperation.
 2. The method claimed in claim 1, wherein selecting thecontext set further includes selecting a specific context for decodingthe significant-coefficient flag in the DC position of the first blockif it is the upper-left block in the transform unit.
 3. The methodclaimed in claim 1, wherein selecting the context set is further basedon whether or not the first block is in the upper-left corner of thetransform unit.
 4. The method claimed in claim 1, wherein selecting thecontext set is further based upon the size of the transform unit.
 5. Themethod claimed in claim 1, wherein selecting the context set is furtherbased upon whether components of the transform unit are luma componentsor chroma components.
 6. A decoder for decoding a bitstream of encodeddata to reconstruct significant-coefficient flags for a transform unit,the transform unit comprising a sequence of blocks in a scan order, thebitstream encoding sets of significant-coefficient flags, each setcorresponding to a respective block, each block having an associatedsignificant-coefficient-group flag that indicates whether thesignificant-coefficient flags corresponding to that block are to bedecoded from the bitstream or may be inferred to be zero, the decodercomprising: a processor; a memory; and a decoding application stored inmemory and containing processor-readable instructions which, whenexecuted by the processor, cause the processor to (i) for a set ofsignificant-coefficient flags corresponding to a first block with anassociated non-zero significant-coefficient-group flag, select a contextset from a plurality of context sets for use in decodingsignificant-coefficient flags of that set based on asignificant-coefficient-group flag associated with a block to the rightof the first block and a significant-coefficient-group flag associatedwith a block below the first block, wherein the context sets identifythe contexts to be used in context-adaptively decoding thesignificant-coefficient flags of that set of significant-coefficientflags, and wherein a first context set is selected if both of thesignificant-coefficient-group flags are non-zero, and, otherwise, adifferent, mutually exclusive context set is selected, (ii) entropydecode the significant-coefficient flags of that set using the selectedcontext set by, for each significant-coefficient flag, selecting acontext from within the selected context set for context-adaptivelydecoding that significant-coefficient flag, and (iii) move to the nextblock in the scan order and return to operation (i), wherein eachsignificant-coefficient-group flag indicates whether its associatedblock is presumed to contain at least one non-zerosignificant-coefficient flag, wherein for each block in the sequence ofblocks that has an associated significant-coefficient-group flag that isdecoded to be zero, there are no non-zero significant-coefficient flagsin that block, and for each block in the sequence of blocks that has anassociated significant-coefficient-group flag that is decoded to benon-zero, there is at least one non-zero significant-coefficient flag inthat block, and wherein for each block in the sequence of blocks thathas an associated significant-coefficient-group flag that is zero, allof the significant-coefficient flags in that block are set to zeroinstead of performing the selecting operation and the entropy decodingoperation.
 7. The decoder claimed in claim 6, wherein the processorselects the context set by further selecting a specific context fordecoding the significant-coefficient flag in the DC position of thefirst block if it is the upper-left block in the transform unit.
 8. Thedecoder claimed in claim 6, wherein the processor selects the contextset by further selecting the context set based on whether or not thefirst block is in the upper-left corner of the transform unit.
 9. Thedecoder claimed in claim 6, wherein the processor selects the contextset further based upon the size of the transform unit.
 10. The decoderclaimed in claim 6, wherein the processor selects the context setfurther based upon whether components of the transform unit are lumacomponents or chroma components.
 11. A method of encoding a video byencoding significant-coefficient flags for a transform unit to create abitstream of encoded sets of significant-coefficient flags, thetransform unit comprising a sequence of blocks in a scan order, each setof significant-coefficient flags corresponding to a respective block,each block having an associated significant-coefficient-group flag thatindicates whether the significant-coefficient flags corresponding tothat block are to be encoded in the bitstream or may be inferred to bezero, the method comprising: (i) for a set of significant-coefficientflags corresponding to a first block with an associated non-zerosignificant-coefficient-group flag, selecting a context set from aplurality of context sets for use in encoding significant-coefficientflags of that set based on a significant-coefficient-group flagassociated with a block to the right of the first block and asignificant-coefficient-group flag associated with a block below thefirst block, wherein the context sets identify the contexts to be usedin context-adaptively encoding the significant-coefficient flags of thatset of significant-coefficient flags, wherein selecting includesselecting a first context set if both of thesignificant-coefficient-group flags are non-zero, and, otherwise,selecting a different, mutually exclusive context set; (ii) entropyencoding the significant-coefficient flags of that set using theselected context set by, for each significant-coefficient flag,selecting a context from within the selected context set forcontext-adaptively encoding that significant-coefficient flag; and (iii)moving to the next block in the scan order and returning to operation(i), wherein each significant-coefficient-group flag indicates whetherits associated block is presumed to contain at least one non-zerosignificant-coefficient flag, wherein for each block in the sequence ofblocks that has an associated significant-coefficient-group flag that iszero and encoded in the bitstream, there are no non-zerosignificant-coefficient flags in that block, and for each block in thesequence of blocks that has an associated significant-coefficient-groupflag that is non-zero and encoded in the bitstream, there is at leastone non-zero significant-coefficient flag in that block, and wherein foreach block in the sequence of blocks that has an associatedsignificant-coefficient-group flag that is zero, all of thesignificant-coefficient flags in that block are zero and the selectingoperation and the entropy encoding operation are not performed.
 12. Anencoder for encoding significant-coefficient flags for a transform unitto produce a bitstream of encoded data, the transform unit comprising asequence of blocks in a scan order, each set of significant-coefficientflags corresponding to a respective block, each block having anassociated significant-coefficient-group flag that indicates whether thesignificant-coefficient flags corresponding to that block are to beencoded in the bitstream or may be inferred to be zero, the encodercomprising: a processor; a memory; and an encoding application stored inmemory and containing instructions which, when executed by theprocessor, cause the processor to (i) for a set ofsignificant-coefficient flags corresponding to a first block with anassociated non-zero significant-coefficient-group flag, select a contextset from a plurality of context sets for use in encodingsignificant-coefficient flags of that set based on asignificant-coefficient-group flag associated with a block to the rightof the first block and a significant-coefficient-group flag associatedwith a block below the first block, wherein the context sets identifythe contexts to be used in context-adaptively encoding thesignificant-coefficient flags of that set of significant-coefficientflags, and wherein a first context set is selected if both of thesignificant-coefficient-group flags are non-zero, and, otherwise, adifferent, mutually exclusive context set is selected, (ii) entropyencode the significant-coefficient flags of that set using the selectedcontext set by, for each significant-coefficient flag, selecting acontext from within the selected context set for context-adaptivelyencoding that significant-coefficient flag, and (iii) move to the nextblock in the scan order and return to operation (i), wherein eachsignificant-coefficient-group flag indicates whether its associatedblock is presumed to contain at least one non-zerosignificant-coefficient flag wherein for each block in the sequence ofblocks that has an associated significant-coefficient-group flag that iszero and encoded in the bitstream, there are no non-zerosignificant-coefficient flags in that block, and for each block in thesequence of blocks that has an associated significant-coefficient-groupflag that is non-zero and encoded in the bitstream, there is at leastone non-zero significant-coefficient flag in that block, and wherein foreach block in the sequence of blocks that has an associatedsignificant-coefficient-group flag that is zero, all of thesignificant-coefficient flags in that block are zero and the selectingoperation and the entropy encoding operation are not performed.
 13. Anon-transitory processor-readable medium storing processor-executableinstructions which, when executed, configures one or more processors todecode a bitstream of encoded video by reconstructingsignificant-coefficient flags for a transform unit, the transform unitcomprising a sequence of blocks in a scan order, the bitstream encodingsets of significant-coefficient flags, each set corresponding to arespective block, each block having an associatedsignificant-coefficient-group flag that indicates whether thesignificant-coefficient flags corresponding to that block are to bedecoded from the bitstream or may be inferred to be zero, theinstructions, when executed, causing the one or more processors to: (i)for a set of significant-coefficient flags corresponding to a firstblock with an associated non-zero significant-coefficient-group flag,select a context set from a plurality of context sets for use indecoding significant-coefficient flags of that set based on asignificant-coefficient-group flag associated with a block to the rightof the first block and a significant-coefficient-group flag associatedwith a block below the first block, wherein the context sets identifythe contexts to be used in context-adaptively decoding thesignificant-coefficient flags of that set of significant-coefficientflags, and wherein selecting includes selecting a first context set ifboth of the significant-coefficient-group flags are non-zero, and,otherwise, selecting a different, mutually exclusive context set; (ii)entropy decode the significant-coefficient flags of that set using theselected context set by, for each significant-coefficient flag,selecting a context from within the selected context set forcontext-adaptively decoding that significant-coefficient flag; and (iii)move to the next block in the scan order and returning to operation (i),wherein each significant-coefficient-group flag indicates whether itsassociated block is presumed to contain at least one non-zerosignificant-coefficient flag, wherein for each block in the sequence ofblocks that has an associated significant-coefficient-group flag that isdecoded to be zero, there are no non-zero significant-coefficient flagsin that block, and for each block in the sequence of blocks that has anassociated significant-coefficient-group flag that is decoded to benon-zero, there is at least one non-zero significant-coefficient flag inthat block, and wherein for each block in the sequence of blocks thathas an associated significant-coefficient-group flag that is zero, allof the significant-coefficient flags in that block are set to zeroinstead of performing the selecting operation and the entropy decodingoperation.
 14. A non-transitory processor-readable medium storingprocessor-executable instructions which, when executed, configures oneor more processors to encode significant-coefficient flags for atransform unit to produce a bitstream of encoded data, the transformunit comprising a sequence of blocks in a scan order, each set ofsignificant-coefficient flags corresponding to a respective block, eachblock having an associated significant-coefficient-group flag thatindicates whether the significant-coefficient flags corresponding tothat block are to be encoded in the bitstream or may be inferred to bezero, wherein the instructions, when executed are to cause the one ormore processors to: (i) for a set of significant-coefficient flagscorresponding to a first block with an associated non-zerosignificant-coefficient-group flag, select a context set from aplurality of context sets for use in encoding significant-coefficientflags of that set based on a significant-coefficient-group flagassociated with a block to the right of the first block and asignificant-coefficient-group flag associated with a block below thefirst block, wherein the context sets identify the contexts to be usedin context-adaptively encoding the significant-coefficient flags of thatset of significant-coefficient flags, and wherein a first context set isselected if both of the significant-coefficient-group flags arenon-zero, and, otherwise, a different, mutually exclusive context set isselected; (ii) entropy encode the significant-coefficient flags of thatset using the selected context set by, for each significant-coefficientflag, selecting a context from within the selected context set forcontext-adaptively encoding that significant-coefficient flag; and (iii)move to the next block in the scan order and return to operation (i),wherein each significant-coefficient-group flag indicates whether itsassociated block is presumed to contain at least one non-zerosignificant-coefficient flag, wherein for each block in the sequence ofblocks that has an associated significant-coefficient-group flag that iszero and encoded in the bitstream, there are no non-zerosignificant-coefficient flags in that block, and for each block in thesequence of blocks that has an associated significant-coefficient-groupflag that is non-zero and encoded in the bitstream, there is at leastone non-zero significant-coefficient flag in that block, and wherein foreach block in the sequence of blocks that has an associatedsignificant-coefficient-group flag that is zero, all of thesignificant-coefficient flags in that block are zero and the selectingoperation and the entropy encoding operation are not performed.